package oo2;

import java.util.Scanner;

public class JavaTestClass {

	public static void main(String[] args) {
		// 测试班级
		// JavaClass jc2 = new JavaClass();
		// jc2.clsName = "java64";

		JavaClass jc = new JavaClass();
		jc.clsName = "java63";
		jc.beginDate = "2019-8-2";
		jc.dirTeacher = "老刘";
		Scanner in = new Scanner(System.in);
		int ch = 0;
		while (true) {
			System.out.println("1:加新人，2：查看学员信息，3:查找学员  4：提供范围查找  9：退出");
			ch = in.nextInt();
			switch (ch) {
			case 1: {
				System.out.print("请输入新同学的名字：");
				String n = in.next();
				jc.add(n);
			}
				break;
			case 2:
				jc.showNames();
				break;
			case 3: {
				System.out.println("请输入要查找的学生姓名：");
				String n = in.next();
				boolean exist = jc.find(n);
				System.out.println(exist ? "在这个班级" : "不在这个班级");
			}
				break;
			case 4: {
				System.out.println("输入起点：");
				int kaishi = in.nextInt();
				System.out.println("输入终点：");
				int e = in.nextInt();
				System.out.println("再输入找谁？");
				String name = in.next();
				boolean ex = jc.findRange(kaishi, e, name);
				if (ex) {
					System.out.println("在这个范围找到了" + name);
				} else {
					System.out.println("在这个范围没有找到" + name);
				}
			}
				break;
			}
		}
	}

}
